package com.xcity.game.combat.skill.impl;

import java.util.List;

import com.xcity.game.combat.Action;
import com.xcity.game.combat.ActionEffect;
import com.xcity.game.combat.CombatUtils;
import com.xcity.game.combat.skill.CombatSkill;
import com.xcity.game.combat.unit.CombatUnit;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.skill.Skill;

/**
 * 五音不全<br/>
 * 闹太套！一次可怕的攻击，对敌方全体造成{0=35#0}%技能伤害
 * @author yang.li
 *
 */
public class COMBAT_SKILL_90096 extends CombatSkill {

	public COMBAT_SKILL_90096(Skill skill) {
		super(skill);
	}

	@Override
	public void calcDamage(Action action) {
		float rate = skill.getParameter(0) / GameStaticConfig.percentBase;
//		float magicPower = action.unit.getMagicPower() * rate;
		List<CombatUnit> units = action.target.all();
		for (int i = 0; i < units.size(); i++) {
			CombatUnit target = units.get(i);
			if (!target.isDied()) {
				ActionEffect effect = action.addTarget(target);
				target = effect.getUnit(); // 修正目标
//				int damage = (int) (magicPower - CombatUtils.calcMagicDefenseReduceDamage(target));
//				damage = CombatUtils.correctDamage(damage);
//				effect.effect(CombatAttribute.Type.HP, -damage);
				CombatUtils.calcMagicAttack(effect, rate);
			}
		}
	}

}
